package com.bawei.company

import androidx.lifecycle.MutableLiveData
import com.bawei.base.bean.AddCompanyEntity
import com.bawei.base.bean.CompanyApplyEntity
import com.bawei.base.bean.CompanyEntity
import com.bawei.base.mvvm.BaseViewModel
import com.bawei.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class CompanyViewModel @Inject constructor(var apiService: ApiService) :BaseViewModel(){
    var companySuccess=MutableLiveData<MutableList<CompanyEntity>>()
    var companyByIdSuccess=MutableLiveData<CompanyEntity>()
    var addcompanySuccess=MutableLiveData<AddCompanyEntity>()
    var companyApplySuccess=MutableLiveData<MutableList<CompanyApplyEntity>>()
    var companyApplyDetailSuccess=MutableLiveData<CompanyApplyEntity>()
    fun compant(){
        httpRequest({apiService.company()},{companySuccess.postValue(it)})
    }
    fun companyById(id:Int){
        httpRequest({apiService.companyById(id)},{companyByIdSuccess.postValue(it)})
    }
    fun addCompany(addCompanyEntity: AddCompanyEntity){
        httpRequest({apiService.addCompany(addCompanyEntity)},{addcompanySuccess.postValue(it)})
    }
    fun compamyApply(){
        httpRequest({apiService.companyApply()},{companyApplySuccess.postValue(it)})
    }
    fun companyApplyDetail(id:Int){
        httpRequest({apiService.companyApplyById(id)},{companyApplyDetailSuccess.postValue(it)})
    }
}